import { ABP, ListService } from '@abp/ng.core';
import { Component } from '@angular/core';
import { IdentityUserService } from '../proxy/identity';
import { GetIdentityUsersInput, IdentityUserDto } from '../proxy/identity/models';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { RefEntityListComponent } from '../../core/ref-entity-list.component';
import { Observable } from 'rxjs';

@Component({
  selector: 'app-ref-select-user',
  templateUrl: './ref-select-user.component.html',
  providers: [ListService],
})
export class RefSelectUserComponent extends RefEntityListComponent<IdentityUserDto> {
  constructor(
    public readonly listService: ListService<GetIdentityUsersInput>,
    public modalRef: NzModalRef,
    private identityService: IdentityUserService
  ) {
    super(listService, modalRef);
  }

  protected onQuery(query: ABP.PageQueryParams): Observable<any> {
    return this.identityService.getList(query as GetIdentityUsersInput);
  }
}
